import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import 'virtual:svg-icons-register'
// 将所有组件一次性全局注册
import globalComponent from '@/components/index.ts'
// 引入element-plus的所有图标
import * as ElementPlusIconsVue from '@element-plus/icons-vue'


import App from './App.vue'
import router from './router'
// 引入mockjs中的接口
import '../mock/user.ts';

// 引入全局样式
import '@/styles/index.scss'
// 引入暗黑模式的样式
import 'element-plus/theme-chalk/dark/css-vars.css'

const app = createApp(App)
// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(createPinia())
app.use(router)
app.use(ElementPlus)
app.use(globalComponent)

// 引入路由鉴权文件
import './permission.ts';

app.mount('#app')
